// index.js
const jump = require('../../utils/jump.js')
Page({
  data: {
    stuNo: "",
  },

  goToSchool: function(e){
    jump.goToSchool(e)
  },

  goHome: function(e){
    jump.goHome(e)
  },

  checkIn: function(e){
    if (this.data.stuNo) {
    wx.request({
      url: 'http://47.109.143.70/for224/checkin',
      data: {"stu_id": this.data.stuNo},
      header: {"content-type":'application/json'},
      method: "POST",
      success: res=>{
        console.log('请求成功')
        wx.redirectTo({
          url: '/pages/epi_0/checkin',
        })
      },
      fail(res){
        wx.showToast({
          title: res.data.error,
          icon: 'none',
          duration: 2000
        })
      }
    })
  } else {
    wx.redirectTo({
      url: '/pages/epi_0/checkin',
    })
  }
}
})
